// 动态规划思想

let arr = [1,2,3,4]
// let res = [1,3,6,10] 结果

function dynamic(arr) {
    let pb = [...arr]
    for(let i=1; i<pb.length; i++) {
        pb[i] += pb[i-1]
    }
    return pb
}
console.log(dynamic(arr))